package perso.marcr.lst.model;

import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlRootElement;

import perso.marcr.util.ConverterByte;
import perso.marcr.util.Unit;

@XmlRootElement(name = "scenarios")
public class Scenario extends DBModel{

	private List<Double> listAverage = new ArrayList<Double>();

	/**
	 * The title
	 */
	private String title = "";

	/**
	 * The date when the scenario start.
	 */
	private String dateStart = null;

	/**
	 * The date when the scenario end.
	 */
	private String dateEnd = null;

	/**
	 * The size copied.
	 */
	private String sizeCopied = null;

	/**
	 * In seconds
	 */
	private long elaspedTime = 0;

	/**
	 * In Mo/s
	 */
	private String averageSpeed = null;

	/**
	 * 
	 */
	private Status status = null;


	public List<Double> getListAverage() {
		return listAverage;
	}

	public void setListAverage(List<Double> listAverage) {
		this.listAverage = listAverage;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getAverageSpeed() {
		return averageSpeed;
	}

	public void setAverageSpeed(String averageSpeed) {
		this.averageSpeed = averageSpeed;
	}

	public void setAverageSpeed(double dSpeed, Unit unit) {
		this.averageSpeed = ConverterByte.toHumanReadableSpeed(dSpeed, unit);
	}

	public String getSizeCopied() {
		return sizeCopied;
	}

	public void setSizeCopied(String sizeCopied) {
		this.sizeCopied = sizeCopied;
	}	

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	public String toString()
	{
		StringBuffer sb = new StringBuffer();
		sb.append(String.format("Title : %s\n", title));
		sb.append(String.format("Date start: %s\n", dateStart));
		sb.append(String.format("Date end: %s\n", dateEnd));
		sb.append(String.format("Size copied : %s\n", sizeCopied));
		sb.append(String.format("Elapsed time : %s s\n", elaspedTime));
		sb.append(String.format("Average speed : %s\n", averageSpeed));

		return sb.toString();
	}

	public long getElaspedTime() {
		return elaspedTime;
	}

	/**
	 * @param elaspedTime in seconds
	 */
	public void setElaspedTime(long elaspedTime) {
		this.elaspedTime = elaspedTime;
	}

	public String getDateStart() {
		return dateStart;
	}

	public void setDateStart(String dateStart) {
		this.dateStart = dateStart;
	}

	public String getDateEnd() {
		return dateEnd;
	}

	public void setDateEnd(String dateEnd) {
		this.dateEnd = dateEnd;
	}

	public Status getStatus() {
		return status;
	}

	public void setStatus(Status status) {
		this.status = status;
	}	
}
